<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('用户名');
            $table->string('nickname')->nullable()->comment('昵称');
            $table->string('openid')->nullable()->comment('openId');
            $table->string('avatar')->comment('头像');
            $table->string('email')->nullable()->comment('邮箱');
            $table->string('password');
            $table->string('remember_token')->nullable();
            $table->timestamp('email_verify_at')->nullable();
			$table->integer('status')->default(1)->comment('用户状态 1.正常、2.禁用');
            $table->string('mobile',30)->unique()->nullable()->comment('绑定手机号码');
            $table->timestamps();
            $table->softDeletes();
            
            $table->index(['status', 'openid']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
